package com.lebang.controller.api.sdk;

import com.lebang.entity.RequestHeaders;
import com.lebang.service.sys.AdErrorConfigService;
import com.lebangweb.response.Callback;
import com.lebangweb.response.JsonData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

/**
 * @Author: hwq
 * @Date: 2020/9/15 9:47
 * @Version 1.0
 */
@RestController
@RequestMapping("/api/sdkerror")
public class SdkErrorApi {

    @Autowired
    private AdErrorConfigService adErrorConfigService;

    @PostMapping("/log")
    public JsonData log(HttpServletRequest request, String sdkKey,
                        String errorCode, String errorMsg,String area) {
        RequestHeaders headers = new RequestHeaders(request);

        adErrorConfigService.add(sdkKey,errorCode,errorMsg,area,headers);

        return Callback.success("success", "查询成功", null);
    }
}
